//有三个线程，线程名称分别为：a，b，c。
//每个线程打印自己的名称。
//需要让他们同时启动，并按 c，b，a的顺序打印
public class Thread3 {
    private static Object ao = new Object();
    private static Object bo = new Object();
    private static Object co = new Object();
    public static void main(String[] args) {
        Thread a = new Thread(()->{
            synchronized(ao){
                try {
                    ao.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("a");
            }
        });
        Thread b = new Thread(()->{
            synchronized (bo){
                try {
                    bo.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("b");
                synchronized (ao){
                    ao.notify();
                }
            }
        });
        Thread c =new Thread(()->{
            synchronized (co){
                System.out.println("c");
                synchronized (bo){
                    bo.notify();
                }
            }
        });
        a.start();
        b.start();
        c.start();
    }
}
